package ro.cityprojects.adminloc.entities;

import javax.persistence.*;

/**
 * PersonApartment class
 *
 * @author bogdan.solga
 * 
 * Date: 13.06.2013, time: 17:47
 */
@javax.persistence.IdClass(ro.cityprojects.adminloc.entities.PersonApartmentPK.class)
@javax.persistence.Table(name = "PERSON_APARTMENT")
@Entity
public class PersonApartment {

    @Id
    @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    @JoinColumn(name = "APARTMENT_ID", referencedColumnName = "APARTMENT_ID", nullable = false)
    private Apartment apartmentByApartmentId;

    public Apartment getApartmentByApartmentId() {
        return apartmentByApartmentId;
    }

    public void setApartmentByApartmentId(Apartment apartmentByApartmentId) {
        this.apartmentByApartmentId = apartmentByApartmentId;
    }

    @Id
    @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    @JoinColumn(name = "PERSON_ID", referencedColumnName = "PERSON_ID", nullable = false)
    private Person personByPersonId;

    public Person getPersonByPersonId() {
        return personByPersonId;
    }

    public void setPersonByPersonId(Person personByPersonId) {
        this.personByPersonId = personByPersonId;
    }

    @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    @JoinColumn(name = "RELATIONSHIP_ID", referencedColumnName = "RELATIONSHIP_ID", nullable = false)
    private Relationships relationshipsByRelationshipId;

    public Relationships getRelationshipsByRelationshipId() {
        return relationshipsByRelationshipId;
    }

    public void setRelationshipsByRelationshipId(Relationships relationshipsByRelationshipId) {
        this.relationshipsByRelationshipId = relationshipsByRelationshipId;
    }
}
